package com.aaronprj.common.enums.mbooks;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.aaronprj.common.enums.IEnumValueName;

public enum Course implements IEnumValueName{
	Accounting(1,"Accounting", 1, ItemCategory.TextBook),
	Architecture(2,"Architecture", 2, ItemCategory.TextBook),
	Business_Finance(3,"Business & Finance", 3, ItemCategory.TextBook),
	Computer_Science(4,"Computer Science", 4, ItemCategory.TextBook),
	Design(5,"Design", 5, ItemCategory.TextBook),
	Education(6,"Education", 6, ItemCategory.TextBook),
	Engineering(7,"Engineering", 7, ItemCategory.TextBook),
	Law(8,"Law", 8, ItemCategory.TextBook),
	Mathematics(9,"Mathematics", 9, ItemCategory.TextBook),
	Medicine_Health_Sciences(10,"Medicine & Health Sciences", 10, ItemCategory.TextBook),
	Psychology(11,"Psychology", 11, ItemCategory.TextBook),
	Sciences(12,"Sciences", 12, ItemCategory.TextBook),
	Religious_Studies(13,"Religious Studies", 13, ItemCategory.TextBook),
	Study_Guides(14,"Test Prep & Study Guides", 14, ItemCategory.Others),
	Reference(15,"Reference", 5, ItemCategory.Others),
	OTHERS(16,"Others", 16, ItemCategory.Others);
	
	private int value;
	private String displayName;
	private int order;
	private ItemCategory category;
	
	
	Course(int value, String displayName, int order, ItemCategory category){
		this.value = value;
		this.displayName = displayName;
		this.order = order;
		this.category = category;
		
	}
	
	public int getValue() {
		return value;
	}

	public String getDisplayName() {
		return displayName;
	}

	public int getOrder() {
		return order;
	}

	public ItemCategory getCategory() {
		return category;
	}

	public static List<Map<String, Object>> getEntities() {
		List<Map<String, Object>> enums = new ArrayList<Map<String, Object>>();
		for (Course e : Course.values()) {
			if (e instanceof Course) {
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("name", e);
				map.put("displayName", e.getDisplayName());
				map.put("value", e.getValue());
				enums.add(map);
			}
		}
		return enums;
	}

	public static List<Map<String, Object>> getEntitiesByCategory(ItemCategory category) {
		List<Map<String, Object>> enums = new ArrayList<Map<String, Object>>();
		for (Course e : Course.values()) {
			if (e instanceof Course && category.equals(e.getCategory())) {
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("name", e);
				map.put("displayName", e.getDisplayName());
				map.put("value", e.getValue());
				enums.add(map);
			}
		}
		return enums;
	}
	
	

	public static List<Course> getEntityList() {
		List<Course> enumes = new ArrayList<Course>();
		for (Course e : Course.values()) {
			if (e instanceof Course) {
				enumes.add(e);
			}
		}
		return enumes;
	}
}
